package com.example.demo.controller;

import com.example.demo.entity.Employee;
import com.example.demo.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class EmployeeController {

    @Autowired
    private EmployeeService employeeService;

    @GetMapping("insert")
    public String insert(Employee employee){
        employeeService.insert(employee);
    return "OK";
    }

    @GetMapping("update")
    public String update(String xxId,Employee employee){
        employeeService.update(employee);
        employeeService.updateList(xxId);
    return "OK";
    }

    @GetMapping("/getList")
    public List<Employee> getList(String xxId){
        List<Employee> list = employeeService.getList(xxId);
        return list;
    }
    @GetMapping("/adda")
    public List<Employee> add(String xxId){
        List<Employee> list = employeeService.getList(xxId);
        return list;
    }


}
